import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// 导入全局样式
import './assets/css/global.css'

// 导入axios
import axios from 'axios'
// 配置axios请求的根路径
axios.defaults.baseURL = 'https://api.h1234.top/'
// 配置axios请求拦截器
axios.interceptors.request.use(config => {
  // 为请求头对象添加token验证的Authorization字段
  config.headers.Authorization = 'Bearer ' + window.localStorage.getItem('token')
  return config
})

// 将axios挂载到vue的原型属性上
Vue.prototype.$http = axios

Vue.config.productionTip = false

Vue.use(ElementUI)

new Vue({
  router,
  render: h => h(App),
}).$mount('#app')